using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Boggle.Net.Model;
using Boggle.Net.ViewModels;
using Caliburn.Micro;

namespace Boggle.Net.Tests.Stubs
{
    internal sealed class TestingBootstrapper : BootstrapperBase
    {
        protected override void StartRuntime()
        {
            AssemblySource.Instance.AddRange(SelectAssemblies());

            Configure();

            IoC.GetInstance = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp = BuildUp;
        }

        protected override IEnumerable<Assembly> SelectAssemblies()
        {
            return new[]
                   {
                       typeof(TestingBootstrapper).Assembly,
                       typeof(MainViewModel).Assembly
                   };
        }
        
        protected override IWordList EnhancedNorthAmericanBenchmarkWordList
        {
            get
            {
                // ReSharper disable AssignNullToNotNullAttribute
                var fullPath = Path.Combine(Path.GetDirectoryName(typeof(IShell).Assembly.Location), @"..\..\..\ENABLE.txt");
                // ReSharper restore AssignNullToNotNullAttribute
                return new BasicWordList(fullPath);
            }
        }
    }
}